home *** CD-ROM | disk | FTP | other *** search
/ Power Bytes: Money & Finance / PowerBytes Money and Finance CD-ROM 01 / PowerBytes Money and Finance CD-ROM 01.iso / New Stuffed Files / Invoice HELPER®.sit / Invoice HELPERÆ 2.1 / Invoice HELPER∆ 2.1 / background_2580.txt < prev    next >
Encoding:
Text File  |  1988-10-31  |  30.2 KB  |  1,340 lines

  1. -- background: 2580 from stack: in.1
  2. -- bmap block id: 3656
  3. -- flags: 4000
  4. -- background id: 0
  5. -- name: 
  6. ----- HyperTalk script -----
  7. on openBackground
  8.   set cursor to busy
  9.   global firstLineField,lastLineField,sellToField
  10.   put 5 into firstLineField
  11.   put 36 into lastLineField
  12. end openBackground
  13.  
  14. function checkInvoiceMaster
  15. get the short name of this card
  16. if it is "Invoice Master" then
  17.   return true
  18. else
  19.   return false
  20. end if
  21. end checkInvoiceMaster
  22.  
  23. on openCard
  24.   global newInvoice,changedInvoice,deleteFlag
  25.   if deleteFlag is not empty then exit openCard
  26.   -- changedInvoice set if amountDue changed
  27.   if newInvoice then
  28.     put false into newInvoice
  29.   else
  30.     put false into changedInvoice
  31.   end if
  32. end openCard
  33.  
  34. on newCard
  35.   global leadingZeros,currentCustomerNumber,firstLineField, newInvoice,changedInvoice
  36.   put true into newInvoice
  37.   put true into changedInvoice
  38.   set cursor to busy
  39.   set the name of this card to empty
  40.   put the abbrev date into field "Date"
  41.   put currentCustomerNumber into field "Customer Number"
  42.   put "C"¤tCustomerNumber into customer
  43.   set numberFormat to leadingZeros
  44.   get field "Highest Invoice Number" of card "Preferences"
  45.   add 1 to it
  46.   put it into field "Invoice Number"
  47.   set the name of this card to "I"&it
  48.   put it into field "Highest Invoice Number" of card "Preferences"
  49.   get field "Sell to:" of card customer
  50.   put it into field "Sell to:"
  51.   get field "Ship to:" of card customer
  52.   put it into field "Ship to:"
  53.   put "0.00" into field "Amount Due"
  54.   click at loc of field firstLineField
  55. end newCard
  56.  
  57. function findInvoiceLine customer,whichField
  58. global unitFormat
  59. set cursor to busy
  60. -- Assume done only if not "Invoice Master"
  61. set numberFormat to unitFormat -- restore if number fields closed
  62. put empty into foundLine
  63. put field "Invoice Number" into InvoiceNumber
  64. get field whichField of card Customer
  65. repeat with i=1 to the number of lines of it
  66.   set cursor to busy
  67.   if word 1 of line i of it = InvoiceNumber then
  68.     put i into foundLine
  69.     exit repeat
  70.   else
  71.     add 1 to i
  72.   end if
  73. end repeat
  74. return foundLine
  75. end findInvoiceLine
  76.  
  77. function findNextInvoiceLine customer,whichField
  78. global unitFormat
  79. -- find first invoice with greater number
  80. -- Assume done only if not "Invoice Master"
  81. set cursor to busy
  82. set numberFormat to unitFormat -- restore if number fields closed
  83. put empty into foundLine
  84. put field "Invoice Number" into InvoiceNumber
  85. get field whichField of card customer
  86. repeat with i=1 to the number of lines of it
  87.   set cursor to busy
  88.   if word 1 of line i of it > InvoiceNumber then
  89.     put i into foundLine
  90.     exit repeat
  91.   else
  92.     add 1 to i
  93.   end if
  94. end repeat
  95. return foundLine
  96. end findNextInvoiceLine
  97.  
  98. on deleteCard
  99.   global deleteFlag
  100.   set cursor to busy
  101.   if deleteFlag = "All" then exit deleteCard
  102.   if (deleteFlag = "invoice") or (deleteFlag is empty) then
  103.     -- delete invoice from customer
  104.     get field "Customer Number"
  105.     put "C"&it into customer
  106.     put number of field "Unpaid Invoices" of card customer into fieldNumber
  107.     put findInvoiceLine(customer,fieldNumber) into oldLine
  108.     if oldLine is not empty then
  109.       delete line oldLine of field fieldNumber of card customer
  110.     else
  111.       put number of field "Paid Invoices" of card customer into fieldNumber
  112.       put findInvoiceLine(customer,fieldNumber) into oldLine
  113.       if oldLine is not empty then
  114.         delete line oldLine of field fieldNumber of card customer
  115.       end if
  116.     end if
  117.   end if
  118.   get the number of this card
  119.   if it+1 = the number of card "Customer Master" then
  120.     if it-1 Γëá the number of card "Invoice Master" then
  121.       go card it-1 -- normally goes to next card
  122.     else
  123.       go card customer -- return to customer card if last invoice
  124.     end if
  125.   end if
  126. end deleteCard
  127.  
  128. on closeCard
  129.   global findMode,deleteFlag,changedInvoice
  130.   if deleteFlag is not empty then exit closeCard
  131.   if not changedInvoice then exit closeCard
  132.   if findMode then exit closeCard
  133.   if checkInvoiceMaster() then exit closeCard
  134.   set cursor to busy
  135.   get field "Customer Number"
  136.   put "C"&it into Customer
  137.   put number of field "Unpaid Invoices" of card Customer into unpaidInvoices
  138.   put number of field "Paid Invoices" of card Customer into paidInvoices
  139.   if field "Amount Due" Γëá 0 then
  140.     put field "Amount Due" into invoiceText
  141.     put unpaidInvoices into fieldNumber
  142.     put findInvoiceLine(customer,paidInvoices) into oldLine
  143.     if oldLine is not empty then
  144.       delete line oldLine of field paidInvoices of card Customer
  145.     end if
  146.   else
  147.     put field "Total" into invoiceText
  148.     put paidInvoices into fieldNumber
  149.     put findInvoiceLine(customer,unpaidInvoices) into oldLine
  150.     if oldLine is not empty then
  151.       delete line oldLine of field unpaidInvoices of card Customer
  152.     end if
  153.   end if
  154.   if invoiceText is empty then
  155.     put "0.00" into invoiceText
  156.   end if
  157.   repeat while number of characters in invoiceText < 9
  158.     put " "&invoiceText into invoiceText
  159.   end repeat
  160.   put field "Invoice Number"&&invoiceText into invoiceText
  161.   get field "Date"
  162.   convert it to short date
  163.   put invoiceText&&it into invoiceText
  164.   put findInvoiceLine(customer,fieldNumber) into invoiceLine
  165.   if invoiceLine is empty then
  166.     put findNextInvoiceLine(customer,fieldNumber) into invoiceLine
  167.     if invoiceLine is empty then
  168.       get the number of lines of field fieldNumber of card Customer
  169.       add 1 to it
  170.       put it into invoiceLine
  171.     else
  172.       get line invoiceLine of field fieldNumber of card Customer
  173.       put invoiceText&RETURN&it into invoiceText
  174.     end if
  175.   end if
  176.   put invoiceText into line invoiceLine of field fieldNumber of card Customer
  177. end closeCard
  178.  
  179. on showButtons
  180.   repeat with i=1 to the number of bkgnd buttons
  181.     show bkgnd button i
  182.   end repeat
  183. end showButtons
  184.  
  185. on Idle
  186.   global printingInvoice
  187.   if printingInvoice then
  188.     showButtons
  189.     put false into printingInvoice
  190.   end if
  191. end Idle
  192.  
  193. on setUnitFormat
  194.   global unitFormat
  195.   put the number of the target into ourField
  196.   set the numberFormat to unitFormat
  197.   add 0 to field ourField
  198. end setUnitFormat
  199.  
  200. on setDollarFormat
  201.   global dollarsAndCents
  202.   put the number of the target into ourField
  203.   set the numberFormat to dollarsAndCents
  204.   add 0 to field ourField
  205. end setDollarFormat
  206.  
  207. on calcTax
  208.   get field "Sales Tax Rate"
  209.   multiply it by field "SubTotal"
  210.   divide it by 100
  211.   put it into field "Sales Tax"
  212. end calcTax
  213.  
  214. on calcTotal
  215.   global dollarsAndCents,changedInvoice
  216.   set numberFormat to dollarsAndCents
  217.   put field "Amount Due" into oldAmountDue
  218.   put field "Subtotal" into sum
  219.   if the highlight of bkgnd button "Shipping" then
  220.     add field "Shipping" to sum
  221.   end if
  222.   if the highlight of bkgnd button "Sales Tax" then
  223.     calcTax
  224.     add field "Sales Tax" to sum
  225.   end if
  226.   put sum into field "Total"
  227.   subtract field "Amount Received" from sum
  228.   put sum into field "Amount Due"
  229.   if sumΓëáoldAmountDue then
  230.     put true into changedInvoice
  231.   end if
  232. end calcTotal
  233.  
  234. on calcSubtotal
  235.   global dollarsAndCents,unitFormat,firstLineField,lastLineField
  236.   set numberFormat to unitFormat
  237.   put firstLineField+3 into i
  238.   set numberFormat to dollarsAndCents
  239.   put 0 into sum
  240.   repeat while i<=lastLineField
  241.     add field i to sum
  242.     set numberFormat to unitFormat
  243.     add 4 to i
  244.     set numberFormat to dollarsAndCents
  245.   end repeat
  246.   put sum into field "Subtotal"
  247.   calcTotal
  248. end calcSubtotal
  249.  
  250. on calcLine -- Calculate quantity*unitPrice for line
  251.   -- When either field is closed
  252.   global dollarsAndCents,unitFormat,firstLineField,lastLineField
  253.   set numberFormat to unitFormat
  254.   get the number of the target
  255.   put it into ourField
  256.   subtract firstLineField from it
  257.   put trunc(it/4) into quotient
  258.   put it-4*quotient into it
  259.   put ourField+2-it into unitCostField
  260.   put unitCostField-2 into quantityField
  261.   put unitCostField+1 into priceField
  262.   set numberFormat to dollarsAndCents
  263.   put field unitCostField into unitCost
  264.   if unitCost is not empty then
  265.     put field quantityField into quantity
  266.     if quantity is empty then
  267.       put 1 into quantity
  268.     end if
  269.     put quantity*unitCost into price
  270.     put price into field priceField
  271.   else
  272.     put empty into field priceField
  273.   end if
  274.   calcSubtotal
  275. end calcLine
  276.  
  277. on returnToCustomer
  278.   set cursor to busy
  279.   if checkInvoiceMaster() then exit returnToCustomer
  280.   get field "Customer Number"
  281.   go card "C"&it
  282. end returnToCustomer
  283.  
  284. on controlKey keyValue
  285.   set cursor to busy
  286.   if keyValue = 3 then -- C
  287.     returnToCustomer
  288.   else
  289.     pass controlKey keyValue
  290.   end if
  291. end controlKey
  292.  
  293. on arrowKey direction
  294.   set cursor to busy
  295.   if direction="left" then
  296.     click at loc of bkgnd button "Left Arrow"
  297.     exit arrowKey
  298.   else
  299.     if direction="right" then click at loc of bkgnd button "Right Arrow"
  300.   end if
  301. end arrowKey
  302.  
  303.  
  304.  
  305. -- part 1 (field)
  306. -- low flags: 01
  307. -- high flags: 0000
  308. -- rect: left=75 top=65 right=82 bottom=131
  309. -- title width / last selected line: 0
  310. -- icon id / first selected line: 0 / 0
  311. -- text alignment: 0
  312. -- font id: 3
  313. -- text size: 10
  314. -- style flags: 256
  315. -- line height: 13
  316. -- part name: Invoice Number
  317.  
  318.  
  319. -- part 2 (field)
  320. -- low flags: 01
  321. -- high flags: 0000
  322. -- rect: left=360 top=65 right=82 bottom=494
  323. -- title width / last selected line: 0
  324. -- icon id / first selected line: 0 / 0
  325. -- text alignment: 0
  326. -- font id: 3
  327. -- text size: 10
  328. -- style flags: 256
  329. -- line height: 13
  330. -- part name: Date
  331.  
  332.  
  333. -- part 3 (field)
  334. -- low flags: 01
  335. -- high flags: 6002
  336. -- rect: left=10 top=96 right=157 bottom=225
  337. -- title width / last selected line: 0
  338. -- icon id / first selected line: 0 / 0
  339. -- text alignment: 0
  340. -- font id: 3
  341. -- text size: 10
  342. -- style flags: 0
  343. -- line height: 13
  344. -- part name: Sell to:
  345.  
  346.  
  347. -- part 4 (field)
  348. -- low flags: 01
  349. -- high flags: 6002
  350. -- rect: left=281 top=96 right=157 bottom=496
  351. -- title width / last selected line: 0
  352. -- icon id / first selected line: 0 / 0
  353. -- text alignment: 0
  354. -- font id: 3
  355. -- text size: 10
  356. -- style flags: 0
  357. -- line height: 13
  358. -- part name: Ship to:
  359.  
  360.  
  361. -- part 5 (field)
  362. -- low flags: 00
  363. -- high flags: 0002
  364. -- rect: left=45 top=168 right=184 bottom=88
  365. -- title width / last selected line: 0
  366. -- icon id / first selected line: 0 / 0
  367. -- text alignment: 65535
  368. -- font id: 3
  369. -- text size: 10
  370. -- style flags: 0
  371. -- line height: 13
  372. -- part name: Units 1
  373. ----- HyperTalk script -----
  374. on closeField
  375.   setunitFormat
  376.   CalcLine
  377. end closeField
  378.  
  379.  
  380. -- part 6 (field)
  381. -- low flags: 00
  382. -- high flags: 0002
  383. -- rect: left=87 top=168 right=184 bottom=346
  384. -- title width / last selected line: 0
  385. -- icon id / first selected line: 0 / 0
  386. -- text alignment: 0
  387. -- font id: 3
  388. -- text size: 10
  389. -- style flags: 0
  390. -- line height: 13
  391. -- part name: Item 1
  392.  
  393.  
  394. -- part 7 (field)
  395. -- low flags: 00
  396. -- high flags: 0002
  397. -- rect: left=345 top=168 right=184 bottom=413
  398. -- title width / last selected line: 0
  399. -- icon id / first selected line: 0 / 0
  400. -- text alignment: 65535
  401. -- font id: 3
  402. -- text size: 10
  403. -- style flags: 0
  404. -- line height: 13
  405. -- part name: Item Price 1
  406. ----- HyperTalk script -----
  407. on closeField
  408.   setDollarFormat
  409.   CalcLine
  410. end closeField
  411.  
  412.  
  413. -- part 9 (field)
  414. -- low flags: 01
  415. -- high flags: 0002
  416. -- rect: left=412 top=168 right=184 bottom=480
  417. -- title width / last selected line: 0
  418. -- icon id / first selected line: 0 / 0
  419. -- text alignment: 65535
  420. -- font id: 3
  421. -- text size: 10
  422. -- style flags: 0
  423. -- line height: 13
  424. -- part name: Quanity Price 1
  425.  
  426.  
  427. -- part 18 (field)
  428. -- low flags: 00
  429. -- high flags: 0002
  430. -- rect: left=45 top=183 right=199 bottom=88
  431. -- title width / last selected line: 0
  432. -- icon id / first selected line: 0 / 0
  433. -- text alignment: 65535
  434. -- font id: 3
  435. -- text size: 10
  436. -- style flags: 0
  437. -- line height: 13
  438. -- part name: Units 1
  439. ----- HyperTalk script -----
  440. on closeField
  441.   setunitFormat
  442.   CalcLine
  443. end closeField
  444.  
  445.  
  446. -- part 19 (field)
  447. -- low flags: 00
  448. -- high flags: 0002
  449. -- rect: left=87 top=183 right=199 bottom=346
  450. -- title width / last selected line: 0
  451. -- icon id / first selected line: 0 / 0
  452. -- text alignment: 0
  453. -- font id: 3
  454. -- text size: 10
  455. -- style flags: 0
  456. -- line height: 13
  457. -- part name: Item 1
  458.  
  459.  
  460. -- part 20 (field)
  461. -- low flags: 00
  462. -- high flags: 0002
  463. -- rect: left=345 top=183 right=199 bottom=413
  464. -- title width / last selected line: 0
  465. -- icon id / first selected line: 0 / 0
  466. -- text alignment: 65535
  467. -- font id: 3
  468. -- text size: 10
  469. -- style flags: 0
  470. -- line height: 13
  471. -- part name: Item Price 1
  472. ----- HyperTalk script -----
  473. on closeField
  474.   setDollarFormat
  475.   CalcLine
  476. end closeField
  477.  
  478.  
  479. -- part 21 (field)
  480. -- low flags: 01
  481. -- high flags: 0002
  482. -- rect: left=412 top=183 right=199 bottom=480
  483. -- title width / last selected line: 0
  484. -- icon id / first selected line: 0 / 0
  485. -- text alignment: 65535
  486. -- font id: 3
  487. -- text size: 10
  488. -- style flags: 0
  489. -- line height: 13
  490. -- part name: Quanity Price 1
  491. ----- HyperTalk script -----
  492. on closeField
  493.   global dollarsAndCents
  494.   set numberFormat to dollarsAndCents
  495.   put the number of the target into nr
  496.   get field nr
  497.   add 0 to it
  498.   put it into field nr
  499. end closeField
  500.  
  501.  
  502. -- part 22 (field)
  503. -- low flags: 00
  504. -- high flags: 0002
  505. -- rect: left=45 top=198 right=214 bottom=88
  506. -- title width / last selected line: 0
  507. -- icon id / first selected line: 0 / 0
  508. -- text alignment: 65535
  509. -- font id: 3
  510. -- text size: 10
  511. -- style flags: 0
  512. -- line height: 13
  513. -- part name: Units 1
  514. ----- HyperTalk script -----
  515. on closeField
  516.   setunitFormat
  517.   CalcLine
  518. end closeField
  519.  
  520.  
  521. -- part 23 (field)
  522. -- low flags: 00
  523. -- high flags: 0002
  524. -- rect: left=87 top=198 right=214 bottom=346
  525. -- title width / last selected line: 0
  526. -- icon id / first selected line: 0 / 0
  527. -- text alignment: 0
  528. -- font id: 3
  529. -- text size: 10
  530. -- style flags: 0
  531. -- line height: 13
  532. -- part name: Item 1
  533.  
  534.  
  535. -- part 24 (field)
  536. -- low flags: 00
  537. -- high flags: 0002
  538. -- rect: left=345 top=198 right=214 bottom=413
  539. -- title width / last selected line: 0
  540. -- icon id / first selected line: 0 / 0
  541. -- text alignment: 65535
  542. -- font id: 3
  543. -- text size: 10
  544. -- style flags: 0
  545. -- line height: 13
  546. -- part name: Item Price 1
  547. ----- HyperTalk script -----
  548. on closeField
  549.   setDollarFormat
  550.   CalcLine
  551. end closeField
  552.  
  553.  
  554. -- part 25 (field)
  555. -- low flags: 01
  556. -- high flags: 0002
  557. -- rect: left=412 top=198 right=214 bottom=480
  558. -- title width / last selected line: 0
  559. -- icon id / first selected line: 0 / 0
  560. -- text alignment: 65535
  561. -- font id: 3
  562. -- text size: 10
  563. -- style flags: 0
  564. -- line height: 13
  565. -- part name: Quanity Price 1
  566. ----- HyperTalk script -----
  567. on closeField
  568.   global dollarsAndCents
  569.   set numberFormat to dollarsAndCents
  570.   put the number of the target into nr
  571.   get field nr
  572.   add 0 to it
  573.   put it into field nr
  574. end closeField
  575.  
  576.  
  577. -- part 26 (field)
  578. -- low flags: 00
  579. -- high flags: 0002
  580. -- rect: left=45 top=213 right=229 bottom=88
  581. -- title width / last selected line: 0
  582. -- icon id / first selected line: 0 / 0
  583. -- text alignment: 65535
  584. -- font id: 3
  585. -- text size: 10
  586. -- style flags: 0
  587. -- line height: 13
  588. -- part name: Units 1
  589. ----- HyperTalk script -----
  590. on closeField
  591.   setunitFormat
  592.   CalcLine
  593. end closeField
  594.  
  595.  
  596. -- part 27 (field)
  597. -- low flags: 00
  598. -- high flags: 0002
  599. -- rect: left=87 top=213 right=229 bottom=346
  600. -- title width / last selected line: 0
  601. -- icon id / first selected line: 0 / 0
  602. -- text alignment: 0
  603. -- font id: 3
  604. -- text size: 10
  605. -- style flags: 0
  606. -- line height: 13
  607. -- part name: Item 1
  608.  
  609.  
  610. -- part 28 (field)
  611. -- low flags: 00
  612. -- high flags: 0002
  613. -- rect: left=345 top=213 right=229 bottom=413
  614. -- title width / last selected line: 0
  615. -- icon id / first selected line: 0 / 0
  616. -- text alignment: 65535
  617. -- font id: 3
  618. -- text size: 10
  619. -- style flags: 0
  620. -- line height: 13
  621. -- part name: Item Price 1
  622. ----- HyperTalk script -----
  623. on closeField
  624.   setDollarFormat
  625.   CalcLine
  626. end closeField
  627.  
  628.  
  629. -- part 29 (field)
  630. -- low flags: 01
  631. -- high flags: 0002
  632. -- rect: left=412 top=213 right=229 bottom=480
  633. -- title width / last selected line: 0
  634. -- icon id / first selected line: 0 / 0
  635. -- text alignment: 65535
  636. -- font id: 3
  637. -- text size: 10
  638. -- style flags: 0
  639. -- line height: 13
  640. -- part name: Quanity Price 1
  641. ----- HyperTalk script -----
  642. on closeField
  643.   global dollarsAndCents
  644.   set numberFormat to dollarsAndCents
  645.   put the number of the target into nr
  646.   get field nr
  647.   add 0 to it
  648.   put it into field nr
  649. end closeField
  650.  
  651.  
  652. -- part 30 (field)
  653. -- low flags: 00
  654. -- high flags: 0002
  655. -- rect: left=45 top=228 right=244 bottom=88
  656. -- title width / last selected line: 0
  657. -- icon id / first selected line: 0 / 0
  658. -- text alignment: 65535
  659. -- font id: 3
  660. -- text size: 10
  661. -- style flags: 0
  662. -- line height: 13
  663. -- part name: Units 1
  664. ----- HyperTalk script -----
  665. on closeField
  666.   setunitFormat
  667.   CalcLine
  668. end closeField
  669.  
  670.  
  671. -- part 31 (field)
  672. -- low flags: 00
  673. -- high flags: 0002
  674. -- rect: left=87 top=228 right=244 bottom=346
  675. -- title width / last selected line: 0
  676. -- icon id / first selected line: 0 / 0
  677. -- text alignment: 0
  678. -- font id: 3
  679. -- text size: 10
  680. -- style flags: 0
  681. -- line height: 13
  682. -- part name: Item 1
  683.  
  684.  
  685. -- part 32 (field)
  686. -- low flags: 00
  687. -- high flags: 0002
  688. -- rect: left=345 top=228 right=244 bottom=413
  689. -- title width / last selected line: 0
  690. -- icon id / first selected line: 0 / 0
  691. -- text alignment: 65535
  692. -- font id: 3
  693. -- text size: 10
  694. -- style flags: 0
  695. -- line height: 13
  696. -- part name: Item Price 1
  697. ----- HyperTalk script -----
  698. on closeField
  699.   setDollarFormat
  700.   CalcLine
  701. end closeField
  702.  
  703.  
  704. -- part 33 (field)
  705. -- low flags: 01
  706. -- high flags: 0002
  707. -- rect: left=412 top=228 right=244 bottom=480
  708. -- title width / last selected line: 0
  709. -- icon id / first selected line: 0 / 0
  710. -- text alignment: 65535
  711. -- font id: 3
  712. -- text size: 10
  713. -- style flags: 0
  714. -- line height: 13
  715. -- part name: Quanity Price 1
  716. ----- HyperTalk script -----
  717. on closeField
  718.   global dollarsAndCents
  719.   set numberFormat to dollarsAndCents
  720.   put the number of the target into nr
  721.   get field nr
  722.   add 0 to it
  723.   put it into field nr
  724. end closeField
  725.  
  726.  
  727. -- part 34 (field)
  728. -- low flags: 00
  729. -- high flags: 0002
  730. -- rect: left=45 top=243 right=259 bottom=88
  731. -- title width / last selected line: 0
  732. -- icon id / first selected line: 0 / 0
  733. -- text alignment: 65535
  734. -- font id: 3
  735. -- text size: 10
  736. -- style flags: 0
  737. -- line height: 13
  738. -- part name: Units 1
  739. ----- HyperTalk script -----
  740. on closeField
  741.   setunitFormat
  742.   CalcLine
  743. end closeField
  744.  
  745.  
  746. -- part 35 (field)
  747. -- low flags: 00
  748. -- high flags: 0002
  749. -- rect: left=87 top=243 right=259 bottom=346
  750. -- title width / last selected line: 0
  751. -- icon id / first selected line: 0 / 0
  752. -- text alignment: 0
  753. -- font id: 3
  754. -- text size: 10
  755. -- style flags: 0
  756. -- line height: 13
  757. -- part name: Item 1
  758.  
  759.  
  760. -- part 36 (field)
  761. -- low flags: 00
  762. -- high flags: 0002
  763. -- rect: left=345 top=243 right=259 bottom=413
  764. -- title width / last selected line: 0
  765. -- icon id / first selected line: 0 / 0
  766. -- text alignment: 65535
  767. -- font id: 3
  768. -- text size: 10
  769. -- style flags: 0
  770. -- line height: 13
  771. -- part name: Item Price 1
  772. ----- HyperTalk script -----
  773. on closeField
  774.   setDollarFormat
  775.   CalcLine
  776. end closeField
  777.  
  778.  
  779. -- part 37 (field)
  780. -- low flags: 01
  781. -- high flags: 0002
  782. -- rect: left=412 top=243 right=259 bottom=480
  783. -- title width / last selected line: 0
  784. -- icon id / first selected line: 0 / 0
  785. -- text alignment: 65535
  786. -- font id: 3
  787. -- text size: 10
  788. -- style flags: 0
  789. -- line height: 13
  790. -- part name: Quanity Price 1
  791. ----- HyperTalk script -----
  792. on closeField
  793.   global dollarsAndCents
  794.   set numberFormat to dollarsAndCents
  795.   put the number of the target into nr
  796.   get field nr
  797.   add 0 to it
  798.   put it into field nr
  799. end closeField
  800.  
  801.  
  802. -- part 38 (field)
  803. -- low flags: 00
  804. -- high flags: 0002
  805. -- rect: left=45 top=258 right=274 bottom=88
  806. -- title width / last selected line: 0
  807. -- icon id / first selected line: 0 / 0
  808. -- text alignment: 65535
  809. -- font id: 3
  810. -- text size: 10
  811. -- style flags: 0
  812. -- line height: 13
  813. -- part name: Units 1
  814. ----- HyperTalk script -----
  815. on closeField
  816.   setunitFormat
  817.   CalcLine
  818. end closeField
  819.  
  820.  
  821. -- part 39 (field)
  822. -- low flags: 00
  823. -- high flags: 0002
  824. -- rect: left=87 top=258 right=274 bottom=346
  825. -- title width / last selected line: 0
  826. -- icon id / first selected line: 0 / 0
  827. -- text alignment: 0
  828. -- font id: 3
  829. -- text size: 10
  830. -- style flags: 0
  831. -- line height: 13
  832. -- part name: Item 1
  833.  
  834.  
  835. -- part 40 (field)
  836. -- low flags: 00
  837. -- high flags: 0002
  838. -- rect: left=345 top=258 right=274 bottom=413
  839. -- title width / last selected line: 0
  840. -- icon id / first selected line: 0 / 0
  841. -- text alignment: 65535
  842. -- font id: 3
  843. -- text size: 10
  844. -- style flags: 0
  845. -- line height: 13
  846. -- part name: Item Price 1
  847. ----- HyperTalk script -----
  848. on closeField
  849.   setDollarFormat
  850.   CalcLine
  851. end closeField
  852.  
  853.  
  854. -- part 41 (field)
  855. -- low flags: 01
  856. -- high flags: 0002
  857. -- rect: left=412 top=258 right=274 bottom=480
  858. -- title width / last selected line: 0
  859. -- icon id / first selected line: 0 / 0
  860. -- text alignment: 65535
  861. -- font id: 3
  862. -- text size: 10
  863. -- style flags: 0
  864. -- line height: 13
  865. -- part name: Quanity Price 1
  866. ----- HyperTalk script -----
  867. on closeField
  868.   global dollarsAndCents
  869.   set numberFormat to dollarsAndCents
  870.   put the number of the target into nr
  871.   get field nr
  872.   add 0 to it
  873.   put it into field nr
  874. end closeField
  875.  
  876.  
  877. -- part 42 (field)
  878. -- low flags: 00
  879. -- high flags: 0002
  880. -- rect: left=45 top=273 right=289 bottom=88
  881. -- title width / last selected line: 0
  882. -- icon id / first selected line: 0 / 0
  883. -- text alignment: 65535
  884. -- font id: 3
  885. -- text size: 10
  886. -- style flags: 0
  887. -- line height: 13
  888. -- part name: Units 1
  889. ----- HyperTalk script -----
  890. on closeField
  891.   setunitFormat
  892.   CalcLine
  893. end closeField
  894.  
  895.  
  896. -- part 43 (field)
  897. -- low flags: 00
  898. -- high flags: 0002
  899. -- rect: left=87 top=273 right=289 bottom=346
  900. -- title width / last selected line: 0
  901. -- icon id / first selected line: 0 / 0
  902. -- text alignment: 0
  903. -- font id: 3
  904. -- text size: 10
  905. -- style flags: 0
  906. -- line height: 13
  907. -- part name: Item 1
  908.  
  909.  
  910. -- part 44 (field)
  911. -- low flags: 00
  912. -- high flags: 0002
  913. -- rect: left=345 top=273 right=289 bottom=413
  914. -- title width / last selected line: 0
  915. -- icon id / first selected line: 0 / 0
  916. -- text alignment: 65535
  917. -- font id: 3
  918. -- text size: 10
  919. -- style flags: 0
  920. -- line height: 13
  921. -- part name: Item Price 1
  922. ----- HyperTalk script -----
  923. on closeField
  924.   setDollarFormat
  925.   CalcLine
  926. end closeField
  927.  
  928.  
  929. -- part 45 (field)
  930. -- low flags: 01
  931. -- high flags: 0002
  932. -- rect: left=412 top=273 right=289 bottom=480
  933. -- title width / last selected line: 0
  934. -- icon id / first selected line: 0 / 0
  935. -- text alignment: 65535
  936. -- font id: 3
  937. -- text size: 10
  938. -- style flags: 0
  939. -- line height: 13
  940. -- part name: Quanity Price 1
  941. ----- HyperTalk script -----
  942. on closeField
  943.   global dollarsAndCents
  944.   set numberFormat to dollarsAndCents
  945.   put the number of the target into nr
  946.   get field nr
  947.   add 0 to it
  948.   put it into field nr
  949. end closeField
  950.  
  951.  
  952. -- part 49 (field)
  953. -- low flags: 01
  954. -- high flags: 0000
  955. -- rect: left=412 top=288 right=304 bottom=480
  956. -- title width / last selected line: 0
  957. -- icon id / first selected line: 0 / 0
  958. -- text alignment: 65535
  959. -- font id: 3
  960. -- text size: 10
  961. -- style flags: 0
  962. -- line height: 13
  963. -- part name: Subtotal
  964. ----- HyperTalk script -----
  965. on closeField
  966.   global dollarsAndCents
  967.   set numberFormat to dollarsAndCents
  968.   put the number of the target into nr
  969.   get field nr
  970.   add 0 to it
  971.   put it into field nr
  972. end closeField
  973.  
  974.  
  975. -- part 50 (field)
  976. -- low flags: 00
  977. -- high flags: 0002
  978. -- rect: left=132 top=303 right=319 bottom=195
  979. -- title width / last selected line: 0
  980. -- icon id / first selected line: 0 / 0
  981. -- text alignment: 65535
  982. -- font id: 3
  983. -- text size: 10
  984. -- style flags: 0
  985. -- line height: 13
  986. -- part name: Shipping
  987. ----- HyperTalk script -----
  988. on closeField
  989.   setDollarFormat
  990.   calcTotal
  991. end closeField
  992.  
  993.  
  994. -- part 51 (field)
  995. -- low flags: 80
  996. -- high flags: 0002
  997. -- rect: left=302 top=288 right=304 bottom=346
  998. -- title width / last selected line: 0
  999. -- icon id / first selected line: 0 / 0
  1000. -- text alignment: 65535
  1001. -- font id: 3
  1002. -- text size: 10
  1003. -- style flags: 0
  1004. -- line height: 13
  1005. -- part name: Sales Tax Rate
  1006. ----- HyperTalk script -----
  1007. on closeField
  1008.   calcTax
  1009.   calcTotal
  1010. end closeField
  1011.  
  1012.  
  1013. -- part 52 (field)
  1014. -- low flags: 01
  1015. -- high flags: 0002
  1016. -- rect: left=278 top=303 right=319 bottom=346
  1017. -- title width / last selected line: 0
  1018. -- icon id / first selected line: 0 / 0
  1019. -- text alignment: 65535
  1020. -- font id: 3
  1021. -- text size: 10
  1022. -- style flags: 0
  1023. -- line height: 13
  1024. -- part name: Sales Tax
  1025.  
  1026.  
  1027. -- part 53 (field)
  1028. -- low flags: 01
  1029. -- high flags: 0000
  1030. -- rect: left=412 top=303 right=319 bottom=480
  1031. -- title width / last selected line: 0
  1032. -- icon id / first selected line: 0 / 0
  1033. -- text alignment: 65535
  1034. -- font id: 3
  1035. -- text size: 10
  1036. -- style flags: 0
  1037. -- line height: 13
  1038. -- part name: Total
  1039.  
  1040.  
  1041. -- part 55 (field)
  1042. -- low flags: 00
  1043. -- high flags: 0002
  1044. -- rect: left=87 top=318 right=334 bottom=195
  1045. -- title width / last selected line: 0
  1046. -- icon id / first selected line: 0 / 0
  1047. -- text alignment: 0
  1048. -- font id: 3
  1049. -- text size: 10
  1050. -- style flags: 0
  1051. -- line height: 13
  1052. -- part name: Terms
  1053.  
  1054.  
  1055. -- part 56 (field)
  1056. -- low flags: 00
  1057. -- high flags: 0002
  1058. -- rect: left=278 top=318 right=334 bottom=346
  1059. -- title width / last selected line: 0
  1060. -- icon id / first selected line: 0 / 0
  1061. -- text alignment: 65535
  1062. -- font id: 3
  1063. -- text size: 10
  1064. -- style flags: 0
  1065. -- line height: 13
  1066. -- part name: Amount Received
  1067. ----- HyperTalk script -----
  1068. on closeField
  1069.   SetDollarFormat
  1070.   CalcTotal
  1071. end closeField
  1072.  
  1073.  
  1074. -- part 57 (field)
  1075. -- low flags: 01
  1076. -- high flags: 0000
  1077. -- rect: left=412 top=318 right=334 bottom=480
  1078. -- title width / last selected line: 0
  1079. -- icon id / first selected line: 0 / 0
  1080. -- text alignment: 65535
  1081. -- font id: 3
  1082. -- text size: 10
  1083. -- style flags: 0
  1084. -- line height: 13
  1085. -- part name: Amount Due
  1086.  
  1087.  
  1088. -- part 58 (button)
  1089. -- low flags: 00
  1090. -- high flags: 0005
  1091. -- rect: left=211 top=301 right=319 bottom=229
  1092. -- title width / last selected line: 0
  1093. -- icon id / first selected line: 0 / 0
  1094. -- text alignment: 1
  1095. -- font id: 0
  1096. -- text size: 12
  1097. -- style flags: 0
  1098. -- line height: 16
  1099. -- part name: Sales Tax
  1100. ----- HyperTalk script -----
  1101. on mouseUp
  1102.   global dollarsAndCents
  1103.   set the numberFormat to dollarsAndCents
  1104.   put the number of the target into nr
  1105.   put not highlight of bkgnd button nr into taxable
  1106.   set highlight of bkgnd button nr to taxable
  1107.   if taxable then
  1108.     show field "Sales Tax Rate"
  1109.     calcTax
  1110.   else
  1111.     hide field "Sales Tax Rate"
  1112.     put 0 into it
  1113.     put it+0 into field "Sales Tax"
  1114.   end if
  1115.   calcTotal
  1116. end mouseUp
  1117.  
  1118.  
  1119.  
  1120. -- part 59 (button)
  1121. -- low flags: 00
  1122. -- high flags: 4005
  1123. -- rect: left=70 top=301 right=319 bottom=88
  1124. -- title width / last selected line: 0
  1125. -- icon id / first selected line: 0 / 0
  1126. -- text alignment: 1
  1127. -- font id: 0
  1128. -- text size: 12
  1129. -- style flags: 0
  1130. -- line height: 16
  1131. -- part name: Shipping
  1132. ----- HyperTalk script -----
  1133. on mouseUp
  1134.   global dollarsAndCents
  1135.   set the numberFormat to dollarsAndCents
  1136.   put the number of the target into nr
  1137.   put not highlight of bkgnd button nr into shipping
  1138.   set highlight of bkgnd button nr to shipping
  1139.   if shipping then
  1140.     show field "Shipping"
  1141.   else
  1142.     hide field "Shipping"
  1143.   end if
  1144.   calcTotal
  1145. end mouseUp
  1146.  
  1147.  
  1148.  
  1149. -- part 60 (button)
  1150. -- low flags: 00
  1151. -- high flags: 0000
  1152. -- rect: left=62 top=6 right=41 bottom=98
  1153. -- title width / last selected line: 0
  1154. -- icon id / first selected line: 1007 / 1007
  1155. -- text alignment: 1
  1156. -- font id: 0
  1157. -- text size: 12
  1158. -- style flags: 0
  1159. -- line height: 16
  1160. -- part name: Print
  1161. ----- HyperTalk script -----
  1162. on mouseUp
  1163.   global invoiceCopies,sellToField,firstLineField,lastLineField, leadingZeros,printingInvoice
  1164.   repeat with i=1 to the number of bkgnd buttons
  1165.     hide bkgnd button i
  1166.   end repeat
  1167.   put true into printingInvoice
  1168.   repeat with i=1 to invoiceCopies
  1169.     domenu "Print Card"
  1170.   end repeat
  1171.   put false into printingInvoice
  1172.   showButtons
  1173. end mouseUp
  1174.  
  1175.  
  1176.  
  1177. -- part 61 (button)
  1178. -- low flags: 00
  1179. -- high flags: 0000
  1180. -- rect: left=482 top=0 right=27 bottom=512
  1181. -- title width / last selected line: 0
  1182. -- icon id / first selected line: 20098 / 20098
  1183. -- text alignment: 1
  1184. -- font id: 0
  1185. -- text size: 12
  1186. -- style flags: 0
  1187. -- line height: 16
  1188. -- part name: Home
  1189. ----- HyperTalk script -----
  1190. on mouseUp
  1191.   visual effect iris close
  1192.   go home
  1193. end mouseUp
  1194.  
  1195.  
  1196.  
  1197. -- part 65 (button)
  1198. -- low flags: 00
  1199. -- high flags: A000
  1200. -- rect: left=417 top=1 right=46 bottom=466
  1201. -- title width / last selected line: 0
  1202. -- icon id / first selected line: 11645 / 11645
  1203. -- text alignment: 1
  1204. -- font id: 0
  1205. -- text size: 12
  1206. -- style flags: 0
  1207. -- line height: 16
  1208. -- part name: Customer
  1209. ----- HyperTalk script -----
  1210. on mouseUp
  1211.   returnToCustomer
  1212. end mouseUp
  1213.  
  1214.  
  1215. -- part 66 (field)
  1216. -- low flags: 01
  1217. -- high flags: 0000
  1218. -- rect: left=237 top=65 right=82 bottom=293
  1219. -- title width / last selected line: 0
  1220. -- icon id / first selected line: 0 / 0
  1221. -- text alignment: 1
  1222. -- font id: 3
  1223. -- text size: 10
  1224. -- style flags: 256
  1225. -- line height: 13
  1226. -- part name: Customer Number
  1227. ----- HyperTalk script -----
  1228. on mouseUp
  1229.   returnToCustomer
  1230. end mouseUp
  1231.  
  1232.  
  1233. -- part 68 (button)
  1234. -- low flags: 00
  1235. -- high flags: 2000
  1236. -- rect: left=0 top=307 right=331 bottom=25
  1237. -- title width / last selected line: 0
  1238. -- icon id / first selected line: 1014 / 1014
  1239. -- text alignment: 1
  1240. -- font id: 0
  1241. -- text size: 12
  1242. -- style flags: 0
  1243. -- line height: 16
  1244. -- part name: Left Arrow
  1245. ----- HyperTalk script -----
  1246. on mouseUp
  1247.   -- assumes only Invoice cards between Invoice and Customer Masters
  1248.   get the number of previous card
  1249.   if it > the number of card "Invoice Master" then
  1250.     go previous card
  1251.   else
  1252.     get the number of card "Customer Master"
  1253.     if it-1 > the number of card "Invoice Master" then go card it-1
  1254.   end if
  1255. end mouseUp
  1256.  
  1257.  
  1258.  
  1259. -- part 69 (button)
  1260. -- low flags: 00
  1261. -- high flags: 2000
  1262. -- rect: left=487 top=307 right=331 bottom=512
  1263. -- title width / last selected line: 0
  1264. -- icon id / first selected line: 1013 / 1013
  1265. -- text alignment: 1
  1266. -- font id: 0
  1267. -- text size: 12
  1268. -- style flags: 0
  1269. -- line height: 16
  1270. -- part name: Right Arrow
  1271. ----- HyperTalk script -----
  1272. on mouseUp
  1273.   -- assumes only Invoice cards between Invoice and Customer Masters
  1274.   get the number of next card
  1275.   if it < the number of card "Customer Master" then
  1276.     go next card
  1277.   else
  1278.     get the number of card "Invoice Master"
  1279.     if it+1 < the number of card "Customer Master" then go card it+1
  1280.   end if
  1281. end mouseUp
  1282.  
  1283.  
  1284.  
  1285. -- part 70 (button)
  1286. -- low flags: 00
  1287. -- high flags: 8000
  1288. -- rect: left=0 top=0 right=46 bottom=53
  1289. -- title width / last selected line: 0
  1290. -- icon id / first selected line: 1018 / 1018
  1291. -- text alignment: 1
  1292. -- font id: 0
  1293. -- text size: 12
  1294. -- style flags: 0
  1295. -- line height: 16
  1296. -- part name: Delete Inv.
  1297. ----- HyperTalk script -----
  1298. on mouseUp
  1299.   global deleteFlag
  1300.   if checkInvoiceMaster() then exit mouseUp
  1301.   put "Invoice" into deleteFlag
  1302.   put "C"&&field "Customer Number" into customerCard
  1303.   doMenu "Delete Card"
  1304.   put empty into deleteFlag
  1305. end mouseUp
  1306.  
  1307.  
  1308.  
  1309. -- part 71 (button)
  1310. -- low flags: 00
  1311. -- high flags: 2000
  1312. -- rect: left=482 top=26 right=53 bottom=512
  1313. -- title width / last selected line: 0
  1314. -- icon id / first selected line: 30557 / 30557
  1315. -- text alignment: 1
  1316. -- font id: 0
  1317. -- text size: 12
  1318. -- style flags: 0
  1319. -- line height: 16
  1320. -- part name: Title Card
  1321. ----- HyperTalk script -----
  1322. on mouseUp
  1323.   go card "Title Card"
  1324. end mouseUp
  1325.  
  1326.  
  1327.  
  1328. -- part 82 (field)
  1329. -- low flags: 80
  1330. -- high flags: 0002
  1331. -- rect: left=103 top=2 right=60 bottom=407
  1332. -- title width / last selected line: 0
  1333. -- icon id / first selected line: 0 / 0
  1334. -- text alignment: 1
  1335. -- font id: 4
  1336. -- text size: 12
  1337. -- style flags: 1536
  1338. -- line height: 16
  1339. -- part name: Logo Frame
  1340.